<%@ Page Language="C#" MasterPageFile="~/Master.master" AutoEventWireup="true" CodeFile="ManageUsers.aspx.cs" Inherits="Admin_ManageUsers" Title="Untitled Page" %>
<%@ MasterType VirtualPath="~/Master.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <h1>Manage users</h1>
    
    <div id="divRoles" runat="server" visible="false">

        <h2>Edit Account for user: <span style="color: #000;"><asp:label runat="server" id="AddToRole"/></span></h2>
        
        <asp:repeater runat="server" id="rptAccount">
            <itemtemplate>
                <asp:checkBox runat="server" id="cblRoles" autopostback="true"  oncheckedchanged="cblRoles_CheckedChanged" text='<%#DataBinder.Eval(Container.DataItem, "AccountName")%>' CssClass="checkBox"/>
                <asp:HiddenField ID="hfAccountID" runat="server"  value='<%#DataBinder.Eval(Container.DataItem, "AccountID")%>'/>
                <br />
            </itemtemplate>
        </asp:repeater>
        
        <br />
        
        <h2>Add a new Account</h2>
        
        <div class="formInputTitle">Account:</div>
        <asp:TextBox ID="txtAccount" runat="server" CssClass="formInput" onfocus="this.className='formInputOver';" onblur="this.className='formInput';"></asp:TextBox>
        
        <p><asp:Button ID="btnAccount" runat="server" Text="Add account" OnClick="btnAccount_Click"/></p>

    </div>
    
    <p><a href="AddNewUser.aspx">Add a new user</a></p>

    <asp:GridView ID="gViewUsers" runat="server" AutoGenerateColumns="false" OnRowCommand="gViewUsers_RowCommand">

        <Columns>
        
            <asp:templatefield headertext="Active">
                <itemtemplate>
                    <asp:checkBox runat="server" id="chkActive" oncheckedchanged="chkActive_CheckedChanged" autopostback="true"  checked='<%#DataBinder.Eval(Container.DataItem, "IsApproved")%>'/>
                </itemtemplate>
            </asp:templatefield>
            
            <asp:templatefield headertext="Username">
                <itemtemplate>
                    <asp:label runat="server" id="UserNameLink" text='<%#DataBinder.Eval(Container.DataItem, "UserName")%>'/>
                </itemtemplate>
            </asp:templatefield>
            
            <asp:templatefield>
                <itemtemplate>
                    <asp:linkbutton ID="Linkbutton4" runat="server" commandname="EditAccounts" text="Edit accounts" commandargument='<%# DataBinder.Eval(Container.DataItem, "UserName") %>'/>
                </itemtemplate>
            </asp:templatefield>
            
        </Columns>
        
    </asp:GridView>

</asp:Content>